#include "xNodeType.h"

xNodeType::xNodeType():
_parent( nullptr ),
_inport_fixed( true ),
_outport_fixed( true ),
_name() {
}

xNodeType::~xNodeType() {
}

void xNodeType::setParent( xMappingNode * parent ) {
	this->_parent = parent;
}

xMappingNode * xNodeType::getParent() const {
	return this->_parent;
}

void xNodeType::setInportFixed( bool v ) {
	this->_inport_fixed = v;
}

void xNodeType::setOutportFixed( bool v ) {
	this->_outport_fixed = v;
}

bool xNodeType::getInportFixed() const {
	return this->_inport_fixed;
}

bool xNodeType::getOutportFixed() const {
	return this->_outport_fixed;
}

std::string xNodeType::getName() const {
	return this->_name;
}

void xNodeType::setName( const string & name ) {
	this->_name = name;
}

xMappingTree * xNodeType::getxMappingTree() {
	return nullptr;
}

bool xNodeType::check_valid_pair(std::string valid_pair[][2], int pair_no, std::string typeA, std::string typeB) {
	for (int i=0;i< pair_no; i++) {
		if (valid_pair[i][0] == "dontcare") 
			if (valid_pair[i][1] == typeB) return true ;
		if (valid_pair[i][1] == "dontcare") 
			if (valid_pair[i][0] == typeA) return true ;
		if (valid_pair[i][0] == typeA && valid_pair[i][1] == typeB) return true ;
	}
	return false ;
}
